home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / vbcc-68k-src / machines / amiga68k / libsrc / stdio / fseek.c < prev    next >
C/C++ Source or Header  |  1999-01-01  |  445b  |  21 lines

  1. #include <stdio.h>
  2.  
  3. #include <proto/dos.h>
  4.  
  5. int fseek(FILE *f,long offset,int origin)
  6. {
  7.     if(!f) return(1);
  8.     if(origin==SEEK_CUR){
  9.         if(f->flags&_READ) offset-=f->count;
  10. /*        if(f->flags&_WRITE) offset+=f->count;*/
  11.     }
  12.     if(f->flags&_WRITE) _flushbuf(f);
  13.     f->flags&=~(_READ|_WRITE|_EOF);
  14.     f->count=0;
  15.     if (Seek((BPTR)f->filehandle,offset,origin) == -1){
  16.       f->flags|=_ERR;
  17.       return(1);
  18.     }
  19.     return(0);
  20. }
  21.